package vip.xiaonuo.app.modular.im.controller;

import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.app.modular.appuser.param.front.ApiAppUserParam;
import vip.xiaonuo.core.context.login.LoginContextHolder;
import vip.xiaonuo.core.pojo.response.ResponseData;

import java.util.HashMap;
import java.util.Map;

import static vip.xiaonuo.app.core.tx.TLSSigAPIv2.genUserSig;

/**
 * <p>Title : 腾讯相关接口</p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/11/14 10:22
 */
@RestController
@RequestMapping("/api/tx")
public class TxImController {

    /**
     * 获取用户签名
     *
     * @return
     */
    @GetMapping("/getUserSig")
    public ResponseData getUserSig() {
        Map<String, Object> map = new HashMap<>(16);
        String txCode = LoginContextHolder.me().getSysLoginUser().getTxCode();
        String sig = genUserSig(txCode + "", 3600 * 24 * 7);
        map.put("userSig", sig);//签名
        map.put("txCode", txCode);//腾讯code
        return ResponseData.success(map);
    }


}
